#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@file:dir2.py
@time:2016/11/1 0001 17:25
"""
class A:
    def a(self):
        pass
    def b(self):
        pass
class B:
    def c(self):
        pass
    def d(self):
        pass

def getmembers(klass,members=None):
    if members is None:
        members = []

    for k in klass.__bases__:
        getmembers(k,members)
    for m in dir(klass):
        if m not in members:
            members.append(m)
    return members

print getmembers(A)
print getmembers(B)
print getmembers(IOError)